<!doctype html>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script type="text/javascript">
    var delay = function(time){
        var promise = new Promise(function(resolve,reject){
            setTimeout(function(){
                resolve(time);
            },time);
        });
        return promise;
    };
    delay(5000).then(function(time){
             console.log(time);
    });






    /*var delay = new Promise(function(resolve,reject){
        setTimeout(function(){
              resolve(200);
        },200);
    });

    delay.then(function(){
        console.log('delay 200 after');
    });
*/

</script>

</body>
</html>